#include <iostream>
#include <cstring>
#define MAXN 5000
using namespace std;
int N;
int dir[MAXN], f[MAXN];

void solve();
int main() {
    cin >> N;
    for (int i = 0; i < N; i++) cin >> dir[i];
    solve();
}


// f [i, i + K - 1]是否进行了反转
// f([i + 1 - K + 1, i]) = f([i - K + 1, i - 1]) + f[i] - f[i - K + 1]
int calc(int K) {
    int sum = 0, res = 0;
    for (int i = 0; i + K - 1 < N; i++) {
        // 0表示front
        if ((sum + dir[i]) % 2 != 0) {
            f[i] = 1; dir[i] = 0; res++; // 反转
        }
        sum += f[i];
        if (i - K + 1 >= 0) sum -= f[i - K + 1];
    }

    // 剩余的牛
    for (int i = N - K + 1; i < N; i++) {
        if ((sum + dir[i]) % 2 != 0) return -1;
        if (i - K + 1 >= 0) sum -= f[i - K + 1];
    }
}

void solve() {
    int K = 1, M = N;
    for (int k = 1; k <= N; k++) {
        int m = calc(k);
        if (m >= 0 && M > m) {
            M = m;
            K = k;
        }
    }
    cout << K << ' ' << M << endl;
}